{__NOLAYOUT__}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>跳转提示</title>
    <style type="text/css">
        *{ padding: 0; margin: 0; }
        body{ background: #fff; font-family: '微软雅黑'; color: #CCC; font-size: 16px; }
        .system-message{ padding: 24px 30px; margin:auto; border: #e8e8e8 1px solid; top:50%; width:540px; background-color: #fff;box-shadow: 0 0 8px rgba(0,0,0,0.1);border-radius: 4px;overflow: hidden; }
        .system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 5px; }
        .system-message .jump{ padding-top: 10px; color: #999;}
        .system-message .success,.system-message .error{ line-height: 1.8em;  color: #999; font-size: 36px; font-family: '黑体'; }
        .system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none}

        .system-message .tit{position: relative;height: 50px;line-height: 50px;width: 100%;border-bottom: 1px solid #eee;}
        .system-message .tit i{position: absolute;top: 12px;font-size: 30px;margin-right: 10px;color: #53bb4c;}
        .system-message .tit b{margin: 0 15px 0 30px;font-weight: normal;font-size: 16px;color: #53bb4c;}
        .system-message .tit span{font-size: 14px;margin: 0 10px;color: #999;}
        .system-message ul{margin: 10px auto; overflow: hidden;}
        .system-message ul li{float: left;list-style: none;margin:5px 18px 5px 0;}
        .system-message .buttom{margin: 10px auto; width: 100%; text-align: center; line-height: 40px; color: red;}
    </style>
    <script type="text/javascript">
        var eyou_basefile = window.location.pathname;
        var module_name = "{$Think.const.MODULE_NAME}";
        var __root_dir__ = "__ROOT_DIR__";
    </script>
    <script type="text/javascript" src="__STATIC__/common/js/jquery.tools.min.js"></script>
    <script type="text/javascript">
        $(function(){
            var height2=$('.system-message').height();
            var height1=$(window).height();
            $('.system-message').css('margin-top',((height1-height2)/3)-30);
        });
    </script>
    <script type="text/javascript" src="__PUBLIC__/plugins/layer-v3.1.0/layer.js?v={$version}"></script>
    <script src="__PUBLIC__/plugins/layui/layui.js?v={$version}"></script>
    <!-- Bootstrap core CSS -->
    <script src="__SKIN__/js/global.js?v={$version}"></script>
    <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    {php}
        $post = $_GET;
        isset($post['typeid']) && $post['tid'] = $post['typeid'];
        if (!empty($data) && is_array($data)) {
            $post = array_merge($post, $data);
        }
        $data = $post;
        $row = \think\Db::name('archives')
            ->field("b.*, a.*, a.aid as aid, c.ifsystem,c.ctl_name")
            ->alias('a')
            ->join('__ARCTYPE__ b', 'a.typeid = b.id', 'LEFT')
            ->join('__CHANNELTYPE__ c', 'c.id = a.channel', 'LEFT')
            ->where('a.aid', 'eq', $data['aid'])
            ->find();
        $arcurl = get_arcurl($row);
            $arcurl_home = get_arcurl($row, false);
        $channel = $row['channel'];
        $seo_pseudo = tpCache('seo.seo_pseudo');
        $gourl = cookie('ENV_GOBACK_URL');      //记忆列表
        $listurl = cookie('ENV_LIST_URL')."&typeid=".$data['tid'];  //已发布文档
        $env_is_uphtml = cookie('ENV_IS_UPHTML');
        $action_name = $data['action'];
        $ctl_name = $data['controller'];
        if ('add' == $action_name) {
            $msg = '发布';
            $msg1 = '继续发布';
        } else {
            $msg = '编辑';
            $msg1 = '发布';
        }
        //弹窗修改部分
        $addurl = url('Archives/add', ['typeid'=>$data['tid'],'channel'=>$data['channel']]);
        $editurl = url('Archives/edit', ['typeid'=>$data['tid'],'id'=>$data['aid']]);
        $addurl = $gourl."&msg=新增&openurl=".urlencode($addurl);
        $editurl = $gourl."&msg=编辑&openurl=".urlencode($editurl);
    {/php}
    <div class="system-message">
        <div class="tit">
            <i class="glyphicon glyphicon-ok-circle"></i><span><b>成功{$msg}文档</b>请选择你的后续操作：</span>
        </div>
        <ul>
            <li><span>{$msg1}文档</span><a href="{$addurl}" style="display: none;">{$msg1}文档</a></li>
            <li><span>查看文档</span><a href="{$arcurl}" target="_blank" style="display: none;">查看文档</a></li>
            <li><span>更改文档</span><a href="{$editurl}" style="display: none;">更改文档</a></li>
            <li><span>已发布文档管理</span><a href="{$listurl}" style="display: none;">已发布文档管理</a></li>
            {notempty name='$gourl'}
            <li><span>[记忆的列表页]</span><a href="{$gourl}" style="display: none;">[记忆的列表页]</a></li>
            {/notempty}
        </ul>
        {if condition="2 == $seo_pseudo && 1 != $env_is_uphtml"}
        <div class="buttom" id="tips">正在生成当前文档……请勿刷新！</div>
        <input type="hidden" id="is_uphtml" value="1">
        {else /}
        <input type="hidden" id="is_uphtml" value="0">
        {/if}
    </div>
    <script type="text/javascript">
        $(function(){
            var is_uphtml = $('#is_uphtml').val();
            if (0 == is_uphtml) {
                $('.system-message ul li').each(function(i,o){
                    $(o).find('span').hide();
                    $(o).find('a').show();
                })
            }
        });
    </script>
    {php}
    if (2 == $seo_pseudo && 1 != $env_is_uphtml) {
        cookie('ENV_IS_UPHTML', 1);
    {/php}
    <script type="text/javascript">
        /* 生成静态页面代码 */
        var aid = "{$data['aid']}";
        var typeid = "{$data['tid']}";
        var ctl_name = "{$ctl_name}";
        if(aid > 0){
            $.ajax({
                url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=upHtml",
                type:'POST',
                dataType:'json',
                data:{aid:aid,typeid:typeid,type:'view',ctl_name:ctl_name,_ajax:1},
                success:function(res){
                    layer.closeAll();
                    $('#tips').html('生成文档HTML成功，正在生成栏目……');
                    $.ajax({
                        url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=upHtml",
                        type:'POST',
                        dataType:'json',
                        data:{aid:aid,typeid:typeid,type:'lists',ctl_name:ctl_name,_ajax:1},
                        success:function(res){
                            layer.closeAll();
                            $('#tips').html('');
                            // 百度自动推送
                            push_zzbaidu('{$arcurl_home}', '{$action_name}');
                            // 更新sitemap.xml地图
                            update_sitemap('{$ctl_name}', '{$action_name}');
                        },
                        error: function(e){
                            layer.closeAll();
                            layer.alert('生成当前栏目HTML失败，请手工生成栏目静态！', {icon: 5, title: false});
                        }
                    });
                },
                error: function(e){
                    layer.closeAll();
                    layer.alert('生成HTML失败，请手工生成静态HTML！', {icon: 5, title: false});
                },
                complete:function(){
                    $('.system-message ul li').each(function(i,o){
                        $(o).find('span').hide();
                        $(o).find('a').show();
                    })
                }
            });
        }
        /* end */
    </script>
        {php}
            } else if (in_array($seo_pseudo, [1,3])) {
        {/php}
        <script type="text/javascript">
        /* 生成静态页面代码 */
        var aid = "{$data['aid']}";
        if(aid > 0){
            // 百度自动推送
            push_zzbaidu('{$arcurl_home}', '{$action_name}');
            // 更新sitemap.xml地图
            update_sitemap('{$ctl_name}', '{$action_name}');
        }
        /* end */
        </script>
        {php}
            }
        {/php}
</body>
</html>